Skip to content

feat(mcp): replace the reference number tools with update_record - #511

Merged
alosec merged 1 commit into
mainfrom
alex/mcp-update-record
Nov 6, 2026
Merged

alosec merged 1 commit into
mainfrom
alex/mcp-update-record

Conversation

@alosec

@alosec alosec commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

Akshay asked in Project AI why reference numbers got their own add and remove tools instead of a patch tool. We had ported #452's shape as-is. One record-update tool is the better design: it matches set_party_role and set_custom_field, and it cuts the tool count.

What changes

  • update_record replaces add_reference_numbers and remove_reference_numbers (feat(mcp): add opt-in reference number tools #510). Those were opt-in and never served in production.
  • Inputs: entity_type + entity_id, then ref_numbers: { add, remove } (containers, shipments, tracking requests) and tags: { add, remove } (shipments only).
  • Tier C with confirms: "destructive_only". A call that only adds writes at once. A call that removes anything returns a preview and needs approval, through elicitation or a token. This is the same kit path set_party_role uses.
  • Terminal49 replaces whole lists on PATCH, so the tool reads the lists, merges the change, writes them and reads them back. concurrent_change_detected and the unreadable-list guard carry over from feat(mcp): add opt-in reference number tools #510.
  • It is in the default operations toolset, so production serves it on deploy without an env change. The reference_numbers toolset is removed.
  • The store submission files, docs and counts are updated: 31 default tools, 34 total. The Claude directory listing needs update_record added in the developer portal.

Testing

  • npx vp test run in packages/mcp: 69 files, 1014 tests pass. New tests cover add-only writes, unchanged calls, the removal preview and token, stale previews, shipment tags with reference numbers, unreadable lists, 422 noop, and input validation.
  • Lint, format, the agent-trust guard and the OpenAPI checks pass.
  • Staging QA follows before merge.

🤖 Generated with Claude Code


See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with non-blocking feedback to restore read-back failure tests.

Fix All in CodexFindings

  1. P2 Read-back failure tests were dropped ▶
Fix with agent prompt
### Issue 1
packages/mcp/src/tools/update-record.test.ts:98-100
The replacement tests cover only a successful read-back. The deleted tests also checked a changed list, a failed second GET, and an unreadable second response. Restore those cases for `update_record`, including shipment `tags`. They protect the distinction between `concurrent_change_detected: true` and an unknown result with `read_back_note`, so future changes cannot silently report the wrong result after a successful write.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Replaces the two reference-number tools with update_record in the default operations toolset.

  • One tool updates reference numbers and shipment tags on a record.
  • The default MCP tools now include update_record.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[update_record] --> B[Read requested lists]
  B --> C{Lists readable?}
  C -->|No| D[Return unreadable_list]
  C -->|Yes| E{Any change?}
  E -->|No| F[Return unchanged]
  E -->|Yes| G{Removes a stored value?}
  G -->|No| J[PATCH merged lists]
  G -->|Yes| H[Show preview and ask for approval]
  H --> I[Check approval and current lists]
  I -->|Valid and unchanged| J
  I -->|Changed| H
  J --> K[Read lists back and report result]
Loading

Reviews (1) · Last reviewed commit: "feat(mcp): replace the reference number ..." · Reviewed by Greptile

One update_record tool in the default operations toolset replaces
add_reference_numbers and remove_reference_numbers. It adds and removes
reference numbers on containers, shipments and tracking requests, and tags
on shipments. Like set_party_role and set_custom_field, a call that only
adds writes at once, and a call that removes anything asks first.
The opt-in reference_numbers toolset is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
terminal49 🟢 Ready View Preview Nov 6, 2026, 11:10 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Nov 6, 2026 11:10pm UTC

Request Review

@github-actions github-actions Bot added the risk-shadow:high Shadow-only risk signal: high label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Shadow risk calibration

Signal Result Authority
Path classifier risk:high Deterministic advisory policy
heuristic fallback risk-shadow:high Shadow only

Calibration result: agreement.

Shadow risk never blocks or enables merge. Keep it in observation mode until roughly 50 pull requests have human-reviewed labels, then calibrate before considering any policy use.

alosec added a commit that referenced this pull request Nov 6, 2026
@github-actions github-actions Bot added the risk:unknown Advisory evidence unavailable or changed; no merge permission label Nov 6, 2026
@github-actions github-actions Bot added risk:high Advisory path risk; current-head human review needed and removed risk:unknown Advisory evidence unavailable or changed; no merge permission labels Nov 6, 2026
@alosec
alosec marked this pull request as ready for review November 6, 2026 23:13
@alosec
alosec merged commit 3f4f777 into main Nov 6, 2026
33 checks passed
@alosec
alosec deleted the alex/mcp-update-record branch November 6, 2026 23:13
@github-actions github-actions Bot added risk:unknown Advisory evidence unavailable or changed; no merge permission and removed risk:high Advisory path risk; current-head human review needed labels Nov 6, 2026
Comment on lines +98 to +100
concurrent_change_detected: false,
});
expect(updateRecordOutputSchema.parse(result)).toEqual(result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Read-back failure tests were dropped

The replacement tests cover only a successful read-back. The deleted tests also checked a changed list, a failed second GET, and an unreadable second response. Restore those cases for update_record, including shipment tags. They protect the distinction between concurrent_change_detected: true and an unknown result with read_back_note, so future changes cannot silently report the wrong result after a successful write.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/mcp/src/tools/update-record.test.ts
Line: 98-100

Comment:
**Read-back failure tests were dropped**

The replacement tests cover only a successful read-back. The deleted tests also checked a changed list, a failed second GET, and an unreadable second response. Restore those cases for `update_record`, including shipment `tags`. They protect the distinction between `concurrent_change_detected: true` and an unknown result with `read_back_note`, so future changes cannot silently report the wrong result after a successful write.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code

This branch was successfully deployed

2 active deployments
staging - docs — 81429ce5 Deployed Nov 6, 2026 by mintlify[bot]
Preview — 81429ce5 Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:unknown Advisory evidence unavailable or changed; no merge permission risk-shadow:high Shadow-only risk signal: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant